﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
using System.ComponentModel;
namespace CoreData
{
    public class Group_Module_Role
    {
        [Description("ID")]
            public long ID{get;set;}
        [Description("GroupID")]
            public long GroupID{get;set;}
        [Description("ModuleID")]
            public long ModuleID { get; set; }
        [Description("Quyền")]
            public string Role{get;set;}
        [Description("ID")]
            public string GroupExt { get; set; }
        [Description("Module")]
            public string ModuleExt { get; set; }
        [Description("Ghi chú")]
            public string DescriptionExt { get; set; }
         
        public Group_Module_Role()
        {       
                          //  GroupID ="";   
                           // ModuleID ="";   
                            Role ="";   
        }
        
       static Group_Module_Role DynamicCast<T>(object row_data, object row_header) where T : Group_Module_Role
       {
           // row_data : DataRow
           // row_header : DataColumnCollection
           Group_Module_Role ret = new Group_Module_Role();
           DataRow dt = (DataRow)row_data;

           foreach (DataColumn column in (DataColumnCollection)row_header)
           {
               switch (column.ColumnName)
               {
                      case  "ID":
                        ret.ID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "GroupID":
                        ret.GroupID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "ModuleID":
                       ret.ModuleID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "Role":
                        ret.Role = ConvertObject.ToString(dt[column]);
                       break;
                      case "Group":
                       ret.GroupExt = ConvertObject.ToString(dt[column]);
                       break;
                      case "Module":
                       ret.ModuleExt = ConvertObject.ToString(dt[column]);
                       break;
                      case "Description":
                       ret.DescriptionExt = ConvertObject.ToString(dt[column]);
                       break;
                   default:
                       break;
               }
           }

           return ret;
       }
        
    }
}
